User Tools

Site Tools


z80-mbc2

Z80-MBC2

Homemade 8MHz Z80 SBC, 128kB banked RAM, RTC, SD (HD emulation), Basic and Forth interpreters, CP/M 2.2 and CP/M 3, cross Assembler and C (SDCC).

Description

The Z80-MBC2 is an easy to build Z80 SBC (Single Board Computer).
It is the “evolution” of the Z80-MBC, with a SD as “disk emulator” and with a 128KB banked RAM for CP/M 3 (but it can run CP/M 2.2, QP/M 2.71, UCSD Pascal and Collapse OS too).

It has an optional on board 16x GPIO expander, and uses common cheap add-on modules for the SD and the RTC options.
It has an “Arduino heart” using an Atmega32A as EEPROM and “universal” I/O emulator (so a “legacy” EPROM programmer is not needed).

It is a complete development “ecosystem”, and using the iLoad boot mode it is possible cross-compile, load and execute on the target an Assembler or C program (using the SDCC compiler) with a single command (like in the Arduino IDE).

Preface





Hardware overview

The needed ICs for the “base system” are:

  • Z80 CPU CMOS (Z84C00) 8Mhz or greater
  • Atmega32A
  • TC551001-70 (128kB RAM)
  • 74HC00

If you want the 16x GPIO expansion (GPE option) add a MCP23017 too.

The schematic and the BOM are attached in the Files section.
The MCU Atmega32A is used as universal I/O subsystem, as Eeprom, and as reset and 4/8MHz clock generator for the Z80 CPU.
Inside the Atmega32A it is flashed an Arduino bootloader taken from here, and it is possible to use the Board Manager of the Arduino IDE to “import” it.

Flash the Arduino bootloader at first (with the method you prefer), next you can upload the IOS “sketch” (the I/O Subsystem that interacts with the Z80 bus and “virtualizes” the EEPROM and all the peripherals seen by the Z80 CPU) using Arduino IDE.

You can use the on board ICSP port J3 (also called ISP port) to write the bootloader, but remember to disconnect any other connector when using it. Also both SD and RTC modules (if present) must be removed from the board when the ICSP port is in use.

As clock source for the Z80 CPU it is used the 16MHz Atmega32A oscillator, so the “external 16MHZ osc.” bootloader variant must be chosen when flashing the bootloader from the Arduino IDE!.

The 74HC00 is used as RS flipflop to stop the Z80 CPU during I/O operation, giving the needed time to the Atmega32A to interact with the Z80 bus, and as part of the MMU.

Note that only the CMOS version of the Z80 CPU can be used here.
This because only CMOS version, under given condition that are respected in this schematic, has logical levels compatibles with Atmega32A and 74HC00.

Notes about the components

You should use a Z80 CMOS speed grade of at least 8MHz for full speed, but setting the clock speed at 4MHz you can use a 4MHz Z80 CMOS version too (or you can try to overclock it at 8MHz…).
The 74HC00 can be substituted with a 74HCT00 if you already have one.
The RAM chip TC551001-70 can be substituted with any suitable 128kB SRAM).

Please note that the USER Led must be blue or white (or pink… I've some pink leds that seems to have a Vf like blue one.
May be I'll do a board with them…) just to be sure that V(forward) is >= 2.7V (otherwise the USER key may not work as expected).

The J4 connector (AUX_P) is not currently supported and is not populated by default.

The three solder jumpers (SJ1-3) on the bottom side are not currently supported and must be left opened (as stated in the schematic).

The Serial Port

The SERIAL port (J2, see schematic) can be connected with a TTL-RS232 adapter, or with a serial-USB adapter.
I've used a serial-USB adapter that acts also as power source for the Z80-MBC, and has the DTR signal for the “autoreset” driven from the Arduino IDE.
For a terminal that has a serial TTL port no adapter is needed.

Of course to upload a “sketch” from Arduino IDE you need to use a serial-USB adapter connected to the SERIAL port.

Note that the RTS and CTS pins of the SERIAL port are not currently supported and must be left not connected (as the NC pin!).

The 3V3 pin of the serial-USB adapter must be left disconnected.

You should use those Serial-USB adapters that have the DTR pin on the connector. It is suggested to have also the CTS/RTS signals available for future upgrades:



The optional RTC module

The RTC is a common module based on a DS3231 RTC like this one:


This cheap modules have a trickle charging circuit that may cause the “explosion” of the battery if you use a standard CR2032 cell. More, it can damage also a rechargeable LIR2032 cell.
For more information and how to fix it see here.

The RTC module has it's own pullup resistors on SDA and SCL.
Because the value is 4k7 (the same value used inside the Z80-MBC2 board),
the resulting value will be:

4k7 / 4k7 = 2k3

Because this value is fine there is no need to take away the pullup on the RTC module.

Pay attention on how and where you plug the module in (the only right connector for it is J5 marked as RTC_MOD). If you plug it in the wrong connector or in the wrong way it is possible cause permanent damages to both the module and the Z80-MBC2 board! So plug it as shown in the photos (here a board with the GPE option installed):



uTerm, VT100-like Terminal

uTerm (micro-Term) is a VT100-like terminal for the Z80-MBC2.
It has a VGA out and PS/2 keyboard connector, a power supply for the Z80-MBC2 and a “transparent” serial-USB port.

uTerm can be mounted horizontally or vertically to the Z80-MBC2.

With the uTerm the Z80-MBC2 becomes an “autonomous” computer:






All the details on the uTerm are here.

uCom, RS232

uCom (micro-Com) is a RS232 adapter for the Z80-MBC2.
It has a power supply for the Z80-MBC2 and a “transparent” serial-USB port.

uCom can be mounted horizontally or vertically to the Z80-MBC2:




With the uCom the Z80-MBC2 can be used with a “vintage” RS232 terminal:


All the details on the uCom are here.

Software overview

I've “ported” the Basic interpreter to the Z80-MBC using the sources provided in the great Grant Searle site, after the needed modification due the different HW design.
In the Grant's site is requested an acknowledgement to his site to use this source, so I did here (and I have also emailed to him about this thing).
The resulting ROM image is stored inside the Atmega32A (only for IOS-LITE) and loaded in the TC551001 RAM by the Atmega32A during the system boot.
The original manual of this Basic interpreter is here.


The Forth interpreter is a modified version (for the Z80-MBC2) of that one provided by Bill Westfield for the Z80-MBC.


How enter in the SELECT BOOT MODE or SYSTEM PARAMETERS Menu

To enter in the “Select boot mode or system parameters” you must press the RESET key (SW2), release it and press immediately the USER key (SW1) and keep it pressed until the IOS led starts to blink.

An other way is to press both keys, release the RESET key holding the USER key down until the IOS led starts to blink, or you see the menu on the screen.

In the following screenshots is shown the menu when both the RTC module and the GPE option are installed for IOS-LITE and IOS:



How add files inside a VIRTUAL DISK using CPMTOOLSGUI

The Z80-MBC2 maps any disk like A: B: C: etc. into an image file on SD card with this file name: DSxNyy.DSK;

where x (from 0 to 9) is OS:

0 = CP/M 2.2
1 = QP/M 2.71
2 = CP/M 3

and yy (from 00 to 15) is the disk (00 = A: 01 = B: etc.).

You can download CpmtoolsGUI (English Windows version) from here.

Extract the file CpmtoolsGUI.exe in a new folder and add/overwrite the file diskdefs copying it from the folder cpmtools inside the SD.

STEP 1

Select in the upper left window (Image File) of the CpmtoolsGUI tool the virtual disk where you want to add files.

For CP/M 2.2 and QP/M 2.71:
select z80mbc2-d0 only for disk 0 or z80mbc2-d1 for the others (disk 1 - 15) in the bottom left window (Format) of CpmtoolsGUI.

In the following image is selected (Image File) the disk DS0N02.DSK that corresponds to the disk C: (yy = disk = 02) of the CP/M 2.2 OS (x = 0):


In the center window you can see all the files inside the selected virtual disk (disk 0 - 15).

Please note that if you choose an empty disk (like P:) you won't see any file name in the center window of the CpmtoolsGUI tool.

For CP/M 3:
select in the bottom left window (Format) of CpmtoolsGUI z80mbc2-cpm3 for any disk.

In the following image is selected (Image File) the disk DS2N00.DSK that corresponds to the disk A: (yy = disk = 00) of the CP/M 3 OS (x = 2):


STEP 2

To add one or more files to the selected virtual disk you have simply point the upper right selection window to the folder where the new files are stored in your PC, select them using the bottom right selection window and press the ← P button.
After the add you'll see the added file names in the center window (together with the others file previously present).

STEP 3

Exit from the the CpmtoolsGUI tool pressing the eXit button.

More info here and here.

Project Status

Currently both IOS-LITE and IOS are available.
The first is a simplified version that doesn't support the SD, the second is a full featured version that requires the SD module (e. g. to run CP/M).

The current revision of IOS allows you to run CP/M 2.2, CP/M 3.0, QP/M 2.71, UCSD Pascal, Collapse OS and Fuzix OS (and the stand-alone versions of Basic and Forth, the same supported by IOS-LITE) with 16 virtual disks (8Mbytes each) for each OS.

The add-on board uTerm has been released.

The add-on board uCom has been released.

Not suited for aerospace applications!

How to get a PCB

Because some people asked about this, I've prepared an “easy” link to get a small lot (5 pcs minimum) of PCB.
The link is this one.

If you live in Japan there is this seller in the Tokio area (I'm not “affiliated” with him…).

How to get a Kit or an Assembled unit

If you are looking for a kit with all the needed parts or an assembled unit ready to use now there is a professional seller that can sell both and ship worldwide.

The link to the seller is this one.

Z80-MBC2 User Group

An “User Group” was created on Facebook.

Licensing and Credits

All the project files (SW & HW) are licensed under GPL v3.

If you use this material in any way a reference to the author (me :-) ) will be appreciated.

CP/M seems to be Open Source now (see here).

Basic stand-alone interpreter was an adaptation from Grant Searle work.

Forth stand-alone interpreter was originally ported to the Z80-MBC by Bill Westfield.

UCSD Pascal was ported by Michel Bernard.

Collapse OS was designed and ported by Virgil Dupras.

Fuzix OS was designed and ported by Alan Cox (www.fuzix.org).

Files

Schematic.
A040618_ SCH.pdf.

BOM file.
A040618_BOM_v2.ods.

PCB gerber files.
A040618_Gerber.zip.

PCB Assembly guide.
A040618_Assembly_guide.zip.

The sketch for the IOS-LITE.
IOS-LITE doesn't support the SD (for full SD support use IOS S220718).
S220618_IOS-LITE.ino.zip.

The sketch for the IOS (with the needed libraries).
Unzip into a folder and open the .ino file (with Arduino IDE).
IOS must be uploaded into the Atmega32A flash.
Adds support for Fuzix OS and the SPP Adapter board.
S220718-R290823_IOS_Z80-MBC2.zip.

The sketch for the IOS in executable format (.HEX) with the bootloader.
This executable file is intended for use with a programmer as the Atmel Ice or AVRISPmkII or others (Fuse bits: High Byte 0xD6, Low Byte 0xAF, Lock Byte 0xCF).
S220718-R290823.ino.with_bootloader_atmega32_16000000L.hex.zip.

The content of the microSD needed to run CP/M 2.2, CP/M 3.0, QP/M 2.71, UCSD Pascal, Collapse OS and Fuzix OS with IOS S220718-R290823.
Adds Collapse OS.
S220718-R290823_SD_v2.zip.

The famous game Super Startrek kindly debugged by a RetroBrew Computer Forum user.
Play with Caps-Lock activated! Now the animation works…
STARTREKV2.BAS.zip.

Instructions for STARTREKV2.BAS
TREKINST.BAS.zip.

Some examples showing the new “Virtual I/O Engine” with the stand-alone 8K Basic interpreter.
Examples_with_Basic.txt.zip.

PL2303 USB TTL Adapter latest driver for Windows.
PL2303_prolific_driverinstaller_v1200.zip.

Teraterm 5.0 for Windows.
teraterm-5.0.zip.


z80-mbc2.txt · Last modified: 2024/09/26 08:17 by admin